package com.archstudy.push.platform.contract.constants;


import com.archstudy.push.platform.contract.dto.MsgDTO;

public class PushConstants {


    /**
     * 发送状态 1 分发中  2 分发完成
     */
    public static final int PUSH_FINISHED = 2;
    public static final int PUSH_STARTING = 1;

    /**
     * 2 未读 3 已读
     */
    public static final int PUSHED_BUT_UN_READ = 2;
    public static final int PUSH_READ = 3;



    public static final String WEBSOCKET_SERVER_MONITOR_PATH = "/push-center/WebSocketServer/Monitor";
    public static final String WEBSOCKET_SERVER_LOCK_PATH = "/push-center/WebSocketServer/Monitor-Lock";
    public static final String WEBSOCKET_PROVIDER_HEALTH_URI = ":7704/websocket-provider/api/other/health/v1?name=foo";

    /**
     * 获取mq 的topic
     *
     * @param dto
     * @return
     */
    public static String getTopicKey(MsgDTO dto) {
        return "push_provider";
    }

    /**
     * 获取mq 的flag
     *
     * @param dto
     * @return
     */
    public static String getTopicFlag(MsgDTO dto) {

        Integer type = dto.getTargetType();
        return getTopicFlag(type);

    }

    public static String getTopicFlag(Integer type) {


        MessageTypeEnum[] types = MessageTypeEnum.values();
        for (int i = 0; i < types.length; i++) {
            MessageTypeEnum messageTypeEnum = types[i];
            if (messageTypeEnum.messageType() == type) {

                return messageTypeEnum.name();
            }
        }

        return "UN_KNOWN";
    }



}
